In [1]:
lista = [1,2,3,4,5]
lista.append(6)
In [2]:
lista
Out[2]:
In [3]:
lista.clear()
In [4]:
lista
Out[4]:
In [5]:
l1 = [1,2,3]
l2 = [4,5,6]
l1.extend(l2)
In [6]:
l1
Out[6]:
In [8]:
["Hola", "mundo", "mundo"].count("Hola")
Out[8]:
In [10]:
["Hola", "mundo", "mundo"].index("mundo")
Out[10]:
In [1]:
["Hola", "mundo", "mundo"].index("mundoz")
In [18]:
l = [1,2,3]
l.insert(0,0)
In [19]:
print(l)
In [3]:
l = [5,10,15,25]
l.insert(-1,20)
In [4]:
print(l)
In [5]:
n = len(l)
l.insert(n,30)
In [6]:
print(l)
In [32]:
l.insert(20,999)
In [33]:
print(l)
In [34]:
l = [10,20,30,40,50]
In [35]:
l.pop()
Out[35]:
In [36]:
print(l)
In [37]:
l.pop(0)
Out[37]:
In [38]:
print(l)
In [39]:
l.remove(30)
In [40]:
print(l)
In [41]:
l = [20,30,30,30,40]
In [42]:
l.remove(30)
In [43]:
print(l)
In [44]:
l.reverse()
In [45]:
print(l)
In [58]:
"Hola mundo".reverse()
In [59]:
lista = list("Hola mundo")
In [60]:
lista
Out[60]:
In [61]:
lista.reverse()
In [62]:
lista
Out[62]:
In [63]:
cadena = "".join(lista)
In [64]:
cadena
Out[64]:
In [65]:
lista = [5,-10,35,0,-65,100]
In [66]:
lista.sort()
In [67]:
lista
Out[67]:
In [68]:
lista.sort(reverse=True)
In [69]:
lista
Out[69]: